/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.lacibMusic.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author AlanmLira
 */
@Entity
@Table(name = "Musica")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Musica.findAll", query = "SELECT m FROM Musica m order by m.nomeMusica asc"),
    @NamedQuery(name = "Musica.findById", query = "SELECT m FROM Musica m WHERE m.id = :id"),
    @NamedQuery(name = "Musica.findByDisco", query = "SELECT m FROM Musica m WHERE m.discoid = :disco order by m.faixa asc"),
    @NamedQuery(name = "Musica.findByNomeMusica", query = "SELECT m FROM Musica m WHERE m.nomeMusica = :nomeMusica"),
    @NamedQuery(name = "Musica.findByMusica", query = "SELECT m FROM Musica m WHERE m.musica = :musica"),
    @NamedQuery(name = "Musica.findByGeneroMusical", query = "SELECT m FROM Musica m WHERE m.estiloMusicalid.id = :idMusical"),
    @NamedQuery(name = "Musica.findByFaixa", query = "SELECT m FROM Musica m WHERE m.faixa = :faixa")})
public class Musica implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Size(max = 100)
    @Column(name = "nomeMusica")
    private String nomeMusica;
    @Size(max = 200)
    @Column(name = "Musica")
    private String musica;
    @Column(name = "faixa")
    private Integer faixa;
    @JoinColumn(name = "Disco_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Disco discoid;
    @JoinColumn(name = "compositor_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Compositor compositorId;
    @JoinColumn(name = "Artista_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Artista artistaid;
    @JoinColumn(name = "EstiloMusical_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private GeneroMusical estiloMusicalid;

    public Musica() {
    }

    public Musica(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNomeMusica() {
        return nomeMusica;
    }

    public void setNomeMusica(String nomeMusica) {
        this.nomeMusica = nomeMusica;
    }

    public String getMusica() {
        return musica;
    }

    public void setMusica(String musica) {
        this.musica = musica;
    }

    public Integer getFaixa() {
        return faixa;
    }

    public void setFaixa(Integer faixa) {
        this.faixa = faixa;
    }

    public Disco getDiscoid() {
        return discoid;
    }

    public void setDiscoid(Disco discoid) {
        this.discoid = discoid;
    }

    public Compositor getCompositorId() {
        return compositorId;
    }

    public void setCompositorId(Compositor compositorId) {
        this.compositorId = compositorId;
    }

    public Artista getArtistaid() {
        return artistaid;
    }

    public void setArtistaid(Artista artistaid) {
        this.artistaid = artistaid;
    }

    public GeneroMusical getEstiloMusicalid() {
        return estiloMusicalid;
    }

    public void setEstiloMusicalid(GeneroMusical estiloMusicalid) {
        this.estiloMusicalid = estiloMusicalid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Musica)) {
            return false;
        }
        Musica other = (Musica) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.lacibMusic.entidades.Musica[ id=" + id + " ]";
    }
    
}
